(function() {
  var __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  define(['chaplin', 'views/layout_view'], function(Chaplin, LayoutView) {
    'use strict';
    var BaseController, _ref;
    return BaseController = (function(_super) {
      __extends(BaseController, _super);

      function BaseController() {
        _ref = BaseController.__super__.constructor.apply(this, arguments);
        return _ref;
      }

      BaseController.prototype.globals = {};

      BaseController.prototype.menuVisible = true;

      BaseController.prototype.initialize = function() {
        var _this = this;
        this.globals = _.clone(window.AppData.CNTRL_GLOBALS);
        this.subscribeEvent('layout:ready', function() {
          var _ref1;
          return _this.publishEvent('layout:updateMenu', (_ref1 = _this.globals.userData) != null ? _ref1.authorities : void 0);
        });
        window.AppData.CNTRL_GLOBALS = {};
        return BaseController.__super__.initialize.apply(this, arguments);
      };

      BaseController.prototype.beforeAction = function() {
        $('#app-container').find('.load-container').remove();
        this.compose('site', LayoutView);
        return this.updateMenu();
      };

      BaseController.prototype.dispose = function() {
        BaseController.__super__.dispose.apply(this, arguments);
        return this.publishEvent('load:show');
      };

      BaseController.prototype.updateMenu = function() {
        if (this.menuVisible) {
          return this.publishEvent('show:menu');
        } else {
          return this.publishEvent('hide:menu');
        }
      };

      return BaseController;

    })(Chaplin.Controller);
  });

}).call(this);
